fix(openai): stop mapping params(top_k=) to top_logprobs - #424
Open
cpsievert wants to merge 1 commit into
Open
Conversation
top_k (sampling) and top_logprobs (response metadata) are unrelated, and OpenAI's API has no top_k sampling parameter. top_k is no longer in supported_model_params(), so it's dropped with the standard unsupported-parameter warning. Matches ellmer's fix (tidyverse/ellmer#1115). Closes #412
cpsievert
force-pushed
the
fix-openai-top-k
branch
from
September 4, 2026 00:52
2c82998 to
c27b39d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #412.
OpenAIProvider.translate_model_params()mapped the standardizedtop_ksampling parameter onto OpenAI'stop_logprobsfield, which controls how many log-probabilities are returned per token — an unrelated setting. Since OpenAI's API has notop_ksampling parameter,top_kis removed fromsupported_model_params()and is now dropped with the standard unsupported-parameter warning, matching ellmer's resolution (tidyverse/ellmer#1115).OpenAICompletionsProvidernever had the mapping; subclasses of the Responses provider (OpenAIAzureProvider,BedrockResponsesProvider) inherit the fix. No VCR cassettes needed re-recording (top_logprobsonly appears in response payloads). Adds a regression test assertingtop_kis not translated.